#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <pthread.h>

void *thread_main(void *arg) {
    for (int i = 0; i < (*(int *)arg); i++) {
        sleep(1);
        printf("running thread %d\n", i);
    }
    return NULL;
}

int main() {
    pthread_t tid;
    int para = 5;
    int rs = pthread_create(&tid, NULL, thread_main, (void *)&para);
    assert(rs == 0);
    sleep(10);
    puts("end of main");    
    return 0;
}

